import openpyxl

#_______________________________________________________________________________________________________________________
#@ 类
class WRITE_EXCEL(object):
    #___________________________________________________________________________________________________________________
    #@ 初始化
    def __init__(self):
        pass
    #___________________________________________________________________________________________________________________
    #@ 写入数据：打开已有表格
    def write_data_add(self,path,data):
        excel = openpyxl.load_workbook(path)
        excel['Sheet'].append(data)
        excel.save(path)
    #___________________________________________________________________________________________________________________
    #@ 写入数据：创建新的表格
    def write_data_new(self,path,data):
        excel = openpyxl.Workbook()
        excel['Sheet'].append(data)
        excel.save(path)








#_______________________________________________________________________________________________________________________
#@ 类
class WRITE_TXT(object):
    #___________________________________________________________________________________________________________________
    #@ 初始化
    def __init__(self):
        pass
    #___________________________________________________________________________________________________________________
    #@ 写入数据
    def write_data_from_list(self,path,data_list):
        txt = open(path,'w',encoding='utf-8')
        for data in data_list:
            txt.write(data)
            txt.write('\n')
        txt.close()
        